#ifndef _THREAD_H_
#define _THREAD_H_

#include "winstdtools.h"

#ifdef WIN
	#include <map>
	#include <Windows.h>
#else
	#include <pthread.h>
    #include <unistd.h>
#endif

namespace StdTools
{
	namespace Threads
	{
#ifdef WIN
		typedef HANDLE ThreadID;
#else
		typedef pthread_t ThreadID;
#endif
		
#ifdef WIN
		class STDTOOLS_API Runnable
#else
		class Runnable
#endif
		{
		public:
			virtual void Run()=0;
		};

#ifdef WIN
		class STDTOOLS_API Thread
#else
		class Thread
#endif
		{
		private:
			Runnable * runnable;
			ThreadID id;

		public:
			Thread(Runnable * runnable);
			~Thread(void);

			//Getters y Setters
			ThreadID getID();

			void start();

			//Funciones estaticas
			static void join(Thread * thread);
		};
	}
}
#endif

